<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/9/28
  Time: 15:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script>
        $(function () {
            $('#img').change(function () {
                var formData = new FormData($("#file")[0]);
                $.ajax({
                    type:"post",
                    url:'merchant/upload',
                    data:formData,
                    contentType: false, //不设置内容类型
                    processData: false, //不处理数据
                    success:function(data) {
                        console.log(data)
                    }
                });
            })
        });
    </script>
</head>
<body>
<form id="file" action="" method="post" enctype="multipart/form-data">
    <input id="img" type="file" name="file">
</form>
</body>
</html>
